<?php
/**
 * Integration test with Example2.
 *
 * @author      Frank Kleine <mikey@xjconf.net>
 * @package     XJConf
 * @subpackage  test_integration
 */
require_once EXAMPLES_DIR . '/Color.php';
require_once EXAMPLES_DIR . '/Complex.php';
require_once EXAMPLES_DIR . '/UpperString.php';
/**
 * Integration test with Example2.
 *
 * @package     XJConf
 * @subpackage  test_integration
 */
class Example2TestCase extends UnitTestCase
{
    /**
     * test if example2 works
     */
    public function testExample2()
    {
        $tagParser = new DefinitionParser();
        $defs      = $tagParser->parse(EXAMPLES_DIR . '/xml/defines2.xml');
        $this->assertEqual($defs->countTagDefinitions(), 3);
        
        $conf = new XmlParser();
        $conf->setTagDefinitions($defs);
        $conf->parse(EXAMPLES_DIR . '/xml/test2.xml');
        
        $this->assertEqual($conf->getConfigValue('one'), 452);
        $this->assertEqual($conf->getConfigValue('two'), 1452);
        $this->assertEqual($conf->getConfigValue('three'), 13);
        $this->assertEqual($conf->getConfigValue('colors'), array('blue', 'purple'));
    }
}
?>